import Opt from '@/components/dt/info/Opt.js'
import rolesOpt from '@/biz/option/roles.js'

class Column extends Opt {

  constructor() {
    super()
    this.build()
  }

  build() {
    this.createAll()
    this.opts.push(...this.all)
  }

  createAll() {
    this.all = [{
        type: 'checkbox',
        width: 50,
        fixed: 'left'
      }, {
        field: 'workNo',
        minWidth: 100,
        header: {
          filter: {
            key: 'workNo',
            title: '人员工号',
            placeholder: '请输入人员工号',
            input: {}
          }
        }
      }, {
        field: 'name',
        minWidth: 100,
        header: {
          filter: {
            key: 'name',
            title: '人员姓名',
            placeholder: '请输入人员姓名',
            input: {}
          }
        }
      }, {
        field: 'phone',
        minWidth: 120,
        header: {
          filter: {
            key: 'phone',
            title: '人员手机号',
            placeholder: '请输入人员手机号',
            input: {}
          }
        }
      }, {
        field: 'dtOrgInfo',
        title: '所属业务组织',
        minWidth: 120
      }, {
        field: 'role',
        minWidth: 180,
        header: {
          filter: rolesOpt.create({
            key: 'roleIds',
            title: '人员角色',
            multiple: true,
            maxTagCount: 2,
          })
        }
      }, {
        field: 'validate',
        minWidth: 100,
        cell: {
          value: (item) => item.validate == 1 ? '启用' : '禁用',
          text: {}
        },
        header: {
          filter: {
            title: '人员状态',
            key: 'validate',
            placeholder: '请选择',
            select: {
              options: [
                { value: '全部', key: '' },
                { value: '启用', key: '1' },
                { value: '禁用', key: '2' }
              ]
            }
          }
        }
      },
    ]
  }

}

export default Column
